<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <school></school>
        <hr>
    </div>


    <script src="/Vue/Vue基础/JS/vue.js"></script>
    <script>

        //定义student组件
        const student = {
            template: `
                <div>
                    <h2>{{ name }}</h2> 
                    <h2>{{ age }}</h2>    
                </div>
            `,
            data() {
                return {
                    name: '张三',
                    age: 18
                }
            }
        }
        
        //定义school组件
        const school = Vue.extend({
            template: `
                <div>
                    <h2>{{ name }}</h2> 
                    <h2>{{ address }}</h2>  
                    <student></student>  
                </div>
            `,
            data() {
                return {
                    name: '家里蹲',
                    address: '家里'
                }
            },
            components: {
                student
            }
        })

        new Vue({
            el: '#app',
            components: {
                school,
            }
        })
    </script>
</body>

</html>